package com.djj.nanny.util;


import cn.hutool.core.date.DateUtil;
import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;

import jakarta.annotation.Resource;
import com.djj.nanny.service.impl.UserServiceImpl;
import lombok.Getter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.util.Date;

@Getter
@Component
public class JwtTokenUtils {
    @Resource
    private UserServiceImpl userService;
    public static final Logger LOGGER = LoggerFactory.getLogger(JwtTokenUtils.class);

    public static String genToken(String userId,String sign){
    return JWT.create().withAudience(userId).withExpiresAt(DateUtil.offsetHour(new Date(),2)).sign(Algorithm.HMAC256(sign));
    }

}
